package lock_thread;

import java.util.concurrent.locks.LockSupport;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/5/9
 * Time:15:47
 * 休眠之前，Interrupt状态
 **/
public class Demo11 {
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println("休眠之前，Interrupt状态"+
                        Thread.currentThread().isInterrupted());
                LockSupport.park();
                System.out.println("休眠之前，Interrupt状态"+
                        Thread.currentThread().isInterrupted());
            }
        });
        t1.start();

        Thread.sleep(1000);
        //终止线程
        t1.interrupt();
        LockSupport.unpark(t1);
    }
}
